﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UI.Admin.Content.ModelContent.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     <script type="text/javascript" src="/Admin/xheditor-1.2.1/jquery/jquery-1.4.4.min.js"></script>
    <script src="/Admin/xheditor-1.2.1/xheditor-1.2.1.min.js"></script>
    <script src="/Admin/xheditor-1.2.1/xheditor_lang/zh-cn.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <h3 class="header smaller lighter blue">
	    <%=BLL.Find.FindOneColumn(ColumnID).Name %>
	    <small>
		    <i class="icon-double-angle-right"></i>
		    <%=oneDocument!=null?"查看正文":"编辑正文" %>
	    </small>         
    </h3>       

    <div class="row">
		<div class="col-xs-12">
			<!-- PAGE CONTENT BEGINS -->

			<form class="form-horizontal" action="javascript:<%=oneDocument==null?"submit_add_content()":"submit_update_content()" %>">
                 <div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="form-field-1">标题：</label>

					<div class="col-sm-10">
						<input type="text" id="Title"  class="col-xs-10 col-sm-7" value="<%=oneDocument!=null?oneDocument.Title:"" %>"/>
					</div>
				</div>
                <%if(oneDocument!=null){ %>
                <div class="space-4"></div>
                <div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="form-field-1">发布者：</label>
                    <label class="col-sm-2  no-padding-right" for="form-field-1"><%=oneDocument.FirstEditor %></label>	                                   		
				</div>
                  <div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="form-field-1">最后编辑者：</label>
                    <label class="col-sm-2  no-padding-right" for="form-field-1"><%=oneDocument.LastEditor %></label>	                                   		
				</div>
                  <div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="form-field-1">更新时间：</label>
                    <label class="col-sm-2  no-padding-right" for="form-field-1"><%=oneDocument.UpdateDate %></label>	                                   		
				</div>
           <%} %>
          
                  <div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="form-field-1">正文：</label>

					<div class="col-sm-10">
						 <textarea id="Content"   style="height:500px" class="col-xs-10 col-sm-10 xheditor {skin:'o2007silver',upLinkUrl:'/Admin/xheditor-1.2.1/XhEditorUpload.ashx',upImgUrl:'/Admin/xheditor-1.2.1/XhEditorUpload.ashx',upFlashUrl:'/Admin/xheditor-1.2.1/XhEditorUpload.ashx',upMediaUrl:'/Admin/xheditor-1.2.1/XhEditorUpload.ashx',tools:'full', internalStyle: false}">
                             <%=oneDocument!=null?oneDocument.Content:"" %>
						 </textarea>
					</div>
				</div>
                
				<div class="clearfix form-actions">
					<div class="col-md-offset-3 col-md-9">
						<button class="btn btn-primary" type="submit">
							<i class="icon-ok bigger-110"></i>
							提交
						</button>

						&nbsp; &nbsp; &nbsp;
						<button class="btn" type="reset" id="reset" onclick="reset()">
							<i class="icon-undo bigger-110"></i>
							重置
						</button> &nbsp;&nbsp;&nbsp;&nbsp;<span class='green' hidden="hidden">*提交成功</span><span class='red' hidden="hidden">*操作失败,所有信息不能为空</span>
                       
					</div>
				</div>
                 <input type="hidden" id="ColumnID" value="<%=ColumnID %>" />
                <input type="hidden" id="ID" value="<%=oneDocument!=null?oneDocument.ID.ToString():"" %>" />
             </form>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
     <script>
         // 添加内容
         function submit_add_content() {
         
             var s = "";
             s = $.ajax({
                 type: "POST",
                 url: "AjaxAction.ashx",
                 data: {
                     dowhat: "add_content",
                     ColumnID: $("#ColumnID").val(),
                     Title: $("#Title").val(),
                     Content: $("#Content").val(),                  
                 },
                 async: false
             }).responseText;
             if (s == "success") {            
                 $(".red").hide();
                 $(".green").show();
                 setTimeout(function () { $(".green").fadeOut() }, 3000);
             }
             else {
           
                 $(".green").hide();
                 $(".red").show();
                 setTimeout(function () { $(".red").fadeOut() }, 3000);
             }
         };
         function reset() {
             window.location.reload();
         }
         // 添加内容
         function submit_update_content() {
             var s = "";
             s = $.ajax({
                 type: "POST",
                 url: "AjaxAction.ashx",
                 data: {
                     dowhat: "Update_content",
                     ColumnID: $("#ColumnID").val(),
                     Title: $("#Title").val(),
                     Content: $("#Content").val(),
                     ID:$("#ID").val()
                 },
                 async: false
             }).responseText;
             if (s == "success") {              
                 $(".red").hide();
                 $(".green").show();
                 setTimeout(function () { $(".green").fadeOut() }, 3000);
             }
             else {
                
                 $(".green").hide();
                 $(".red").show();
                 setTimeout(function () { $(".red").fadeOut() }, 3000);
             }
         };
         function reset() {
             window.location.reload();
         }
   </script>
</asp:Content>
